package zion830.com.range_picker_dialog

import androidx.annotation.IntRange

data class TimeRange(
    @IntRange(from = 0, to = 23) var startHour: Int,
    @IntRange(from = 0, to = 59) var startMinute: Int,
    @IntRange(from = 0, to = 23) var endHour: Int,
    @IntRange(from = 0, to = 59) var endMinute: Int
) {
    //
    fun restore(){
        startHour = 0
        startMinute = 0
        endHour = 0
        endMinute = 0
    }
    // Time string like 'AM 10:30 - PM 1:00'
    val readableTimeRange =
        TimePickerUtils.getReadableTimeString(startHour, startMinute, endHour, endMinute)
    // Time string like '1:00-2:30'
    val numberTimeRange =
        TimePickerUtils.getNumberTimeString(startHour, startMinute, endHour, endMinute)

    // Return whether the start time is earlier than the end time
    fun isCorrectSequence() =
        TimePickerUtils.isCorrectSequence(startHour, startMinute, endHour, endMinute)

    fun getStartTimeSequence():String = TimePickerUtils.getNumberPartString(startHour, startMinute)

    fun getEndTimeSequence():String = TimePickerUtils.getNumberPartString(endHour, endMinute)

}